import abc
from dataclasses import dataclass
from sklearn.base import BaseEstimator, TransformerMixin
import pandas as pd


class BaseTransformer(BaseEstimator, TransformerMixin, abc.ABC):
    
    def fit(self, X, y=None):
        return self
    
    @abc.abstractmethod
    def transform(self, X: pd.DataFrame, *args, **kwargs) -> pd.DataFrame:
        raise NotImplementedError
    

@dataclass
class CopyMixin:
    copy: bool = True
    
    def copy_or(self, x: pd.DataFrame):
        return x.copy() if self.copy else x
    
    
@dataclass
class BarParams:
    col_open: str = 'open'
    col_high: str = 'high'
    col_low: str = 'low'
    col_close: str = 'close'